package com.yjhb.android.sbz.mvp.bidding;

import com.yjhb.android.sbz.entity.PutBidResult;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;
import com.jojo.android.zxlib.base.mvp.CommonView;

import java.math.BigDecimal;

/**
 * 创建者 zx
 * 创建时间 2020/12/9 9:13
 */
public class PutBiddingPresenter extends ConventionPresenter<CommonView<PutBidResult>> {
    private final String TAG = "PutBiddingPresenter";


    @Override
    protected void onDestroy() {

    }

    public PutBiddingPresenter(CommonView<PutBidResult> putBidResultCommonView) {
        super(putBidResultCommonView);
    }




    public void putMoney(BigDecimal money,Integer categoryId,String name,
                         Integer taskId) {
        if (view != null) {
            view.onWait();
        }

        HttpTool.request(model.bidding(money, categoryId, name, taskId), new HttpObserver<PutBidResult>() {
            @Override
            public void onResult(PutBidResult data) {
                if (view != null) {
                    view.onSuccess(data);
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });
    }

}
